package com;

import jakarta.servlet.ServletException;
import jakarta.servlet.annotation.WebServlet;
import jakarta.servlet.http.HttpServlet;
import jakarta.servlet.http.HttpServletRequest;
import jakarta.servlet.http.HttpServletResponse;
import jakarta.servlet.http.HttpSession;

import java.io.IOException;

@WebServlet(name = "LoginServlet3",value = "/LoginServlet3")
public class LoginServlet3 extends HttpServlet {
    public void doGet (HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        response.setContentType("text/html;charset=utf-8");
        String username= request.getParameter("username");
        String password= request.getParameter("password");
        javaBean javaBean=new javaBean(username,password);
        System.out.println(username+password);
//        HttpSession session=request.getSession();
//        session.setAttribute("username",username);
//        session.setAttribute("password",password);
        response.sendRedirect("/web3_war_exploded/welcome.jsp");
    }
    public void doPost(HttpServletRequest request,HttpServletResponse response) throws IOException, ServletException {
        doGet(request,response);
    }
}
